//
//  HRFeedBackViewController.m
//  Hear
//
//  Created by mac on 2017/4/24.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HRFeedBackViewController.h"
#import "PlaceholderTextView.h"
#import <MessageUI/MFMailComposeViewController.h>
#import <MessageUI/MessageUI.h>
@interface HRFeedBackViewController ()<UITextViewDelegate,MFMailComposeViewControllerDelegate>
@property (nonatomic, strong)PlaceholderTextView *noteTextView;
@property (nonatomic, strong)UIButton *submitBtn;

@end

@implementation HRFeedBackViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"意见反馈";
    
    self.view.backgroundColor = [UIColor whiteColor];
    
//    UIButton *leftButton = [UIButton buttonWithType:0];
//    leftButton.size = CGSizeMake(20, 20);
//    [leftButton setImage:[UIImage imageNamed:@"Back-Arrow"] forState:UIControlStateNormal];
//    [leftButton addTarget:self action:@selector(clickMenu) forControlEvents:UIControlEventTouchUpInside];
//    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
//    self.navigationItem.leftBarButtonItem = leftItem;
    
    _noteTextView = [[PlaceholderTextView alloc]initWithFrame:CGRectMake(0, 0, kFullWidth, 200)];
    _noteTextView.textColor = TEXTCOLOR;
    _noteTextView.delegate = self;
    _noteTextView.font = CustomUIFont(14);
    _noteTextView.placeholder = @"请输入你对产品的意见反馈";
    [self.view addSubview:self.noteTextView];
    
    _submitBtn = [[UIButton alloc]init];
    [_submitBtn setTitle:@"提交" forState:UIControlStateNormal];
    [_submitBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [_submitBtn setBackgroundColor:BlueColor];
    [_submitBtn addTarget:self action:@selector(submitBtnClicked) forControlEvents:UIControlEventTouchUpInside];
    _submitBtn.layer.cornerRadius = 8;
    _submitBtn.clipsToBounds = YES;
    _submitBtn.frame = CGRectMake(20, _noteTextView.bottom+30, kFullWidth -40, 45);
    [self.view addSubview:self.submitBtn];

}
- (void)clickMenu{
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)submitBtnClicked{
    
    if (!self.noteTextView.text.length){
        [MBProgressHUD showMessage:@"反馈意见不能为空" finishBlock:nil];
        return;
    }
    
    [MBProgressHUD showMessage:@"提交成功" finishBlock:nil];

    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.hidesBottomBarWhenPushed = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
